package model;

/**
 * 
 * @author Sonny Sandberg
 */
public class BSSingleton 
{
    private static BSSingleton singletonObject;
    private User loggedInUser;
    
    private BSSingleton() 
    {
        loggedInUser = null;
    }
    
    public static synchronized BSSingleton getSingletonObject() 
    {
        if (singletonObject == null) 
        {
            singletonObject = new BSSingleton();
        }
        return singletonObject;
    }
    
    @Override
    public Object clone() throws CloneNotSupportedException 
    {
        return getSingletonObject();
    }

    public User getLoggedInUser()
    {
        return loggedInUser;
    }

    public void setLoggedInUser(User loggedInUser)
    {
        this.loggedInUser = loggedInUser;
    }
    
    public void clearLoggedInUser()
    {
        loggedInUser = null;
    }
}
